using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for Customer
/// </summary>
public class Customer : IBusinessEntity
{
    private int _customerID;
    private string _contactNumber;
    private string _fullName;
    private string _address;
    private string _email;
    private string _phoneNumber;

    public Customer(int id, string contactNumber, string fullName, string address, string email, string phoneNumber)
	{
        _customerID = id;
        _contactNumber = contactNumber;
        _fullName = fullName;
        _address = address;
        _email = email;
        _phoneNumber = phoneNumber;
	}

    public Customer()
    {
    }

    public int CustomerID
    {
        get
        {
            return _customerID;
        }
        set
        {
            _customerID = value;
        }
    }

    public string ContactNumber
    {
        get
        {
            return _contactNumber;
        }
        set
        {
            _contactNumber = value;
        }
    }

    public string FullName
    {
        get
        {
            return _fullName;
        }
        set
        {
            _fullName = value;
        }
    }

    public string Address
    {
        get
        {
            return _address;
        }
        set
        {
            _address = value;
        }
    }

    public string Email
    {
        get
        {
            return _email;
        }
        set
        {
            _email = value;
        }
    }

    public string PhoneNumber
    {
        get
        {
            return _phoneNumber;
        }
        set
        {
            _phoneNumber = value;
        }
    }

    #region IBusinessEntity Members

    public void Fill(System.Data.SqlClient.SqlDataReader reader)
    {
        if (DAL.ColumnExists(reader, "CustomerID"))
            _customerID = reader.GetInt32(0);
        if (DAL.ColumnExists(reader, "ContactNumber"))
            _contactNumber = reader.GetString(1);
        if (DAL.ColumnExists(reader, "FullName"))
            _fullName = reader.GetString(2);
        if (DAL.ColumnExists(reader, "Address") && !reader.IsDBNull(3))
            _address = reader.GetString(3);
        if (DAL.ColumnExists(reader, "Email") && !reader.IsDBNull(4))
            _email = reader.GetString(4);
        if (DAL.ColumnExists(reader, "PhoneNumber") && !reader.IsDBNull(5))
            _phoneNumber = reader.GetString(5);
    }

    #endregion
}
